<?php
/*
 * @author HX<titanrain@163.com>
 */
class Page{
	private $pageno;
	private $pagesize;
	private $offset;
	private $pagecount;
	private $totalrecord;
	private $recordlist;
	
	public function __construct($pageno,$pagesize){
		$this->pageno = $pageno;
		$this->pagesize = $pagesize;
		$this->offset = ($pageno-1)*$pagesize;
		if($this->offset<0){
			$this->offset = 0;
		}
	}

	public function LimitStr(){
		return ' limit '.$this->offset.','.$this->pagesize;
	}
	
	
	public function __get($args){
		return $this->$args;
	}
	
	public function __set($key,$value){
		$this->$key = $value;
		if($key == 'totalrecord'){
			$this->pagecount = ($this->totalrecord + $this->pagesize - 1 )/$this->pagesize;
		}
	}
	
}
